<style lang="less" rel="stylesheet/scss">
    @import '../styles/common.scss';
    .fr{
      float:right;
    }
    .fl{
      float:left;
    }

    .b-leftMenu{
      position: absolute;
      left:0px; top:0px;
      width:200px;
      height:100%; overflow: auto;
      background: #333745;
      z-index: 1;
      img{
        display: block;
        width:70%;
        margin:15px 15%;
        opacity: 0.4;
        transition: all 1s;
        cursor: pointer;
        &:hover{
          opacity: 0.8;
        }
      }
      span{
        display: block;
        line-height:30px;
        color:rgba(255,255,255,0.3);
        padding-left:15px;
        font-size: 12px;
        background: rgba(0,0,0,0.1);
      }
      a{
        display: block;
        line-height:40px;
        color:rgba(255,255,255,0.8);
        font-size: 14px;
        padding-left:20px;
        &:hover{
          background: rgba(0,0,0,0.2);
        }
      }
    }
    .b-rightContent{
      position: absolute;
      left:0px; top:0px;
      min-width:850px;
      width:100%; padding-left:200px;
      height:100%;
      box-sizing:border-box;
      background:#EAEDF1;
    }
    .view-frame{
      background: #EAEDF1;
      height:100%; width:100%;
      position:relative;
      &.padding{
        padding:15px;
      }
      &.bg-white{
        background: #fff;
      }

    }
    .view-head{
      background-color:#fff;
      position:absolute;
      top:0px;
      right:0px;
      width:100%;
      padding:20px 0px 20px 20px;
      box-sizing:border-box;
      z-index:50;
    }
    .view-body{
      padding-top:53px;
      box-sizing:border-box;
      position:absolute;
      height:100%;
      width:100%;
      top:0px;
      box-sizing:border-box;
      z-index:20;
    }
    .view-body-main{
      position:relative;
      height:100%;
      overflow-y:auto;
      padding:10px 10px 0px 10px;
      box-sizing:border-box;
    }
    .login_out{
      position:absolute;
      top:6px;
      right:14px;
      z-index:52;
    }

    
</style>

<template>
    <div class="content-box">
        <div class="b-leftMenu">
            <img src="../images/logo.png"/>
            <div class="nav-item" v-for="item in items">
                <span>{{item.menu_name}}</span>
                <router-link :to="{path:'/app'+i.url}" v-for="i in item.children">{{i.menu_name}}</router-link>
            </div>
        </div>
        <div class="b-rightContent">
            <div class="login_out"><el-button @click="exit">退出登陆</el-button></div>
              <router-view></router-view>
        </div>
    </div>
</template>
<script>
    import getNetWork from '../libs/getNetWork.js';
    export default {
        data () {
            return {
                items: [
                ]
            };
        },
        methods:{
            // saveState(){
            //     let value=JSON.stringify(this.store);
            //     sessionStorage.setItem('myInfor',value);
            // },
            // getSavedState(){
            //     let stateS=sessionStorage.getItem('myInfor');
            //     if(stateS!==null){
            //         this.store=JSON.parse(stateS);
            //         console.log(this.store);
            //     }
            // },
            getPro(){
                let that=this;
                let data={
                    url:that.getNetDataAddress+'/menu/getMenuByUser',
                    successCallback(res){
                        that.items=res.body.dataArr;
                    }
                }
                getNetWork.get(this,data);
            },
            exit(){
              let that=this;
                let data={
                    url:that.getNetDataAddress+'/login/logoff',
                    successCallback(res){
                        that.$message({
                          message: '退出成功!',
                          type: 'success'
                        });
                        that.myRouter.push({path:"/login/login"});
                        this.store={};
                        let value=JSON.stringify(this.store); 
                        sessionStorage.setItem('myInfor',value);
                    }
                }
                getNetWork.get(this,data);
            }

        },
        mounted(){
            // window.onbeforeunload=()=>{
            //       this.saveState();
            //     }
            // this.getSavedState();
            this.$nextTick(()=>{
                this.getPro();
            });
        }

    }
</script>
